/**
 * ISWE.
 * Created on : 18/07/2009
 *
 * Copyright (c) 2009 ISWE.
 * Rafael Noronha de Almeida
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of Rafael Noronha de Almeida
 * ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Rafael.
 */
package br.com.iswe.recipemaster.gwt.main.client;

import br.com.iswe.gwt.ui.client.ClientInfoContext;
import br.com.iswe.recipemaster.gwt.client.RmBaseModule;
import br.com.iswe.recipemaster.gwt.recipe.client.RecipeCrudPanel;
import br.com.iswe.recipemaster.gwt.security.client.AdminScreen;

import com.google.gwt.user.client.ui.RootPanel;

/**
 *
 * Description: 
 *
 * @author Rafael Noronha de Almeida
 *
 * @version $Revision: 1.2 $ $Date: 2009/07/22 09:04:53 $
 *
 */
public class MainModule extends RmBaseModule {
	protected String getControllerName() {
		return "mainModuleController";
	}
	
	protected void loadModuleMenu() {
		RmMenu iacMenu = new RmMenu(this);
		//listener usado para noticar o menu quando o sessionInfo e modificado
		ClientInfoContext.addOnChangeSessionInfo( iacMenu.getSessionInfoListener() );
		//cria o menu
		iacMenu.buildMenu();
	}
	
	protected void loadModuleScreen() {
		//mostra os menus.
		RootPanel.get(PN_MENU_MODULOS).setVisible(true);
		RootPanel.get(PN_MENU).setVisible(true);
		
		RecipeCrudPanel crudPanel = new RecipeCrudPanel();
		//informa como a ultima pagina esta sendo mostrada
		widgetDisplayed = crudPanel;
	}

	/* (non-Javadoc)
	 * @see br.com.iswe.recipemaster.gwt.client.RmBaseModule#showAdminUserScreen()
	 */
	@Override
	protected void showAdminUserScreen() {
		//esconde os menus
		RootPanel.get(PN_MENU_MODULOS).setVisible(false);
		if(RootPanel.get(PN_MENU) != null){
			RootPanel.get(PN_MENU).setVisible(false);
		}
		
		AdminScreen adminScreen = new AdminScreen();
		RootPanel.get(PN_USE_CASE).add(adminScreen);
		widgetDisplayed = adminScreen;
	}

	/* (non-Javadoc)
	 * @see br.com.iswe.recipemaster.gwt.client.RmBaseModule#showNewUserScreen()
	 */
	@Override
	protected void showNewUserScreen() {
		// TODO Auto-generated method stub
		
	}
}
